package com.datam.dao;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.datam.query.QueryCompanyInfo;
import com.datam.domain.CompanyInfoDO;

@Mapper
public interface CompanyInfoDAO {

	public CompanyInfoDO selectCompanyInfoById(Long id);

	public List< CompanyInfoDO > selectCompanyInfoList(QueryCompanyInfo queryCompanyInfo);

	public Integer countCompanyInfoList(QueryCompanyInfo queryCompanyInfo);

	public int insertCompanyInfo(CompanyInfoDO companyInfoDO);
	
	public int insertCompanyInfo2(QueryCompanyInfo queryCompanyInfo);

	public int updateCompanyInfoById(CompanyInfoDO companyInfoDO);
	
	public List<String> selectDistinctList(QueryCompanyInfo queryCompanyInfo);
	
	public int getseq();

	public void deleteById(@Param("id")long id);

	public List<Map> selectPF(@Param("cntype")String dataType, @Param("mn_id")String code,  @Param("stime")String beginTime,
			 @Param("etime")String endTime);

	public List<Map<String, Object>> getUserByCname(String cname);

	@Select("select SUM(pfl) as pfl ,mn_id,code from popllutant_data where cntype=#{type} and state!=1  GROUP BY mn_id,code")
	public List<Map<String, Object>> selectPfByType(@Param("type")String type, int i);
	
	@Select("update popllutant_data set state=1 where state!=1")
	public void updatePf();
	
	@Select("select 'a25003a25005' as code , sum(value) as pfl ,nm_id	 from pfl_info where code in ('a25003','a25005') group by nm_id")
	public List<Map> selectBj();

	@Select("delete from company_contact where COMPANYID = #{id}")
	public void deleteContact(long id);
	@Select("delete from company_jk_device where COMPANYID = #{id}")
	public void deleteJk(long id);
	@Select("delete from company_pk_yj where COMPANYID = #{id}")
	public void deletePkyj(long id);
	@Select("delete from company_yj where COMPANYID = #{id}")
	public void deleteYj(long id);
	@Select("delete from company_zl_device where COMPANYID = #{id}")
	public void deleteZl(long id);
	@Select("delete from company_zyj where COMPANYID = #{id}")
	public void deleteZYj(long id);
	@Select("delete from pfl_info where company_id = #{id}")
	public void deletePfl(long id);

}

